package org.dromara.app.controller;

import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.annotation.SaIgnore;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.RequiredArgsConstructor;
import org.dromara.bean.domain.bo.HisDepBo;
import org.dromara.bean.domain.vo.HisDepVo;
import org.dromara.bean.service.IHisDepService;
import org.dromara.common.core.domain.R;
import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.core.validate.EditGroup;
import org.dromara.common.excel.utils.ExcelUtil;
import org.dromara.common.idempotent.annotation.RepeatSubmit;
import org.dromara.common.log.annotation.Log;
import org.dromara.common.log.enums.BusinessType;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.web.core.BaseController;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 医院科室
 *
 * @author Lion Li
 * @date 2024-10-17
 */
@Validated
@SaIgnore
@RequiredArgsConstructor
@RestController
@RequestMapping("/app/dep")
public class AHisDepController extends BaseController {

    private final IHisDepService hisDepService;

    /**
     * 查询医院科室列表
     */
    @GetMapping("/getParent")
    public TableDataInfo<HisDepVo> getParent(HisDepBo bo, PageQuery pageQuery) {
        return  hisDepService.list(bo,pageQuery);
    }
    @GetMapping("/list")
    public TableDataInfo<HisDepVo> list(HisDepBo bo, PageQuery pageQuery) {
        return  hisDepService.queryPageList(bo,pageQuery);
    }



    /**
     * 获取医院科室详细信息
     *
     * @param id 主键
     */
    @GetMapping("/{id}")
    public R<HisDepVo> getInfo(@NotNull(message = "主键不能为空")
                                     @PathVariable Long id) {
        return R.ok(hisDepService.queryById(id));
    }


}
